cmake_minimum_required(VERSION 3.16)

project(Template)

file(GLOB SRCS
    ${PROJECT_SOURCE_DIR}/app/*.cpp
    ${PROJECT_SOURCE_DIR}/app/USBCamera/*.cpp
)

include_directories(
    ${PROJECT_SOURCE_DIR}/app
    ${PROJECT_SOURCE_DIR}/app/USBCamera
    /usr/include/x86_64-linux-gnu

)

set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_MAKE_PROGRAM "make")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")


find_package(JPEG  REQUIRED)
message(STATUS "JPEG_FOUND: ${JPEG_FOUND}")
message(STATUS "JPEG_INCLUDE_DIRS: ${JPEG_INCLUDE_DIRS}")
message(STATUS "JPEG_LIBRARIES: ${JPEG_LIBRARIES}")

# link_directories(/usr/lib/x86_64-linux-gnu)

# ffmpeg
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFmpeg REQUIRED libswscale libavutil)

# 输出调试信息
message(STATUS "FFmpeg include dirs: ${FFmpeg_INCLUDE_DIRS}")
message(STATUS "FFmpeg library dirs: ${FFmpeg_LIBRARY_DIRS}")
message(STATUS "FFmpeg libraries: ${FFmpeg_LIBRARIES}")

add_executable(Template ${SRCS})
target_link_libraries(Template swscale)
target_link_libraries(Template JPEG::JPEG)
target_link_libraries(Template x264)


